package com.test01.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.SessionAttributes;

import javax.servlet.http.HttpServletRequest;

/**
 * author: xl
 * time: 2018/5/22 16:19
 * description:
 **/

@Controller
@RequestMapping("/sess")
@SessionAttributes({"a","b"}) //如果有设置键a b同时保存到request和session中
public class SessionAtributeController {


    @RequestMapping(value = "/goReg",method = RequestMethod.GET)
    public String goReg(String pageName, HttpServletRequest request, ModelMap modelMap){
        modelMap.put("name","xiaoli");
        modelMap.put("a","xiaoli");
        request.getSession().setAttribute("c","ccc");
        return "reg/"+pageName;
    }


}
